{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% origin %}
{% load widget_tweaks %}
{% load ietf_filters %}
<form id="search_form"
      class="form-horizontal"
      action="{% url 'ietf.doc.views_search.search' %}">
    <!-- [html-validate-disable-block input-missing-label -- labelled via aria-label] -->
    <div class="input-group search_field">
        {{ form.name|add_class:"form-control"|attr:"placeholder:Document name/title/RFC number"|attr:"aria-label:Document name/title/RFC number" }}
        <button class="btn btn-primary" type="submit">
            <i class="bi bi-search"></i>
            Search
        </button>
    </div>
    {{ form.sort }}
    <div class="accordion pt-3" id="search-accordion">
        <div class="accordion-item">
            <h2 class="accordion-header" id="search-heading">
                <button class="accordion-button collapsed"
                        type="button"
                        data-bs-toggle="collapse"
                        data-bs-target="#search-collapse"
                        aria-expanded="false"
                        aria-controls="search-collapse">
                    Additional search criteria
                </button>
            </h2>
            <div id="search-collapse"
                 class="accordion-collapse collapse"
                 aria-labelledby="search-heading"
                 data-bs-parent="#search-accordion">
                <div class="accordion-body">
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <label class="form-label fw-bold">Document Type</label>
                        </div>
                        <div class="col-sm-8">
                            <div class="form-check">
                                {{ form.rfcs|add_class:"form-check-input" }}
                                <label class="form-check-label" for="{{ form.rfcs.id_for_label }}">RFC</label>
                            </div>
                            <div class="form-check">
                                {{ form.activedrafts|add_class:"form-check-input" }}
                                <label class="form-check-label" for="{{ form.activedrafts.id_for_label }}">Internet-Draft (active)</label>
                            </div>
                            <div class="form-check">
                                {{ form.olddrafts|add_class:"form-check-input advdoctype" }}
                                <label class="form-check-label" for="{{ form.olddrafts.id_for_label }}">Internet-Draft (expired, replaced or withdrawn)</label>
                            </div>
                            {% for value, label in form.fields.doctypes.choices %}
                                <div class="form-check">
                                    <input type="checkbox"
                                           class="form-check-input"
                                           {% if value in form.doctypes.value %}checked{% endif %}
                                           name="doctypes"
                                           value="{{ value }}"
                                           id="id_doctypes_{{ value }}">
                                    <label class="form-check-label" for="id_doctypes_{{ value }}">{{ label|safe|capfirst_allcaps }}</label>
                                </div>
                            {% endfor %}
                        </div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <div class="form-check">
                                <input type="radio"
                                       class="form-check-input"
                                       name="by"
                                       value="author"
                                       {% if form.by.value == "author" %}checked{% endif %}
                                       id="author">
                                <label for="{{ form.author.id_for_label }}" class="form-check-label fw-bold">Author or Affiliation Name</label>
                            </div>
                        </div>
                        <div class="col-sm-8">{{ form.author|add_class:"form-control" }}</div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <div class="form-check">
                                <input type="radio"
                                       class="form-check-input"
                                       name="by"
                                       value="group"
                                       {% if form.by.value == "group" %}checked{% endif %}
                                       id="group">
                                <label for="{{ form.group.id_for_label }}" class="form-check-label fw-bold">WG</label>
                            </div>
                        </div>
                        <div class="col-sm-8">{{ form.group|add_class:"form-control" }}</div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <div class="form-check">
                                <input type="radio"
                                       class="form-check-input"
                                       name="by"
                                       value="area"
                                       {% if form.by.value == "area" %}checked{% endif %}
                                       id="area">
                                <label for="{{ form.area.id_for_label }}" class="form-check-label fw-bold">Area</label>
                            </div>
                        </div>
                        <div class="col-sm-8">{{ form.area|add_class:"select2-field"|attr:"data-minimum-input-length:0"|attr:"data-max-entries:1"|attr:"data-minimum-results-for-search:Infinity" }}</div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <div class="form-check">
                                <input type="radio"
                                       class="form-check-input"
                                       name="by"
                                       value="ad"
                                       {% if form.by.value == "ad" %}checked{% endif %}
                                       id="areadir">
                                <label for="{{ form.ad.id_for_label }}" class="form-check-label fw-bold">AD</label>
                            </div>
                        </div>
                        <div class="col-sm-8">{{ form.ad|add_class:"select2-field"|attr:"data-minimum-input-length:0"|attr:"data-max-entries:1"|attr:"data-minimum-results-for-search:Infinity" }}</div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <div class="form-check">
                                <input type="radio"
                                       class="form-check-input"
                                       name="by"
                                       value="state"
                                       {% if form.by.value == "state" %}checked{% endif %}
                                       id="state">
                                <label for="{{ form.state.id_for_label }}" class="form-check-label fw-bold">IESG State</label>
                            </div>
                        </div>
                        <div class="col-sm-4">{{ form.state|add_class:"select2-field"|attr:"data-minimum-input-length:0"|attr:"data-max-entries:1"|attr:"data-minimum-results-for-search:Infinity" }}</div>
                        <div class="col-sm-4">{{ form.substate|add_class:"select2-field"|attr:"data-minimum-input-length:0"|attr:"data-max-entries:1"|attr:"data-minimum-results-for-search:Infinity" }}</div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <div class="form-check">
                                <input type="radio"
                                       class="form-check-input"
                                       name="by"
                                       value="irtfstate"
                                       {% if form.by.value == "irtfstate" %}checked{% endif %}
                                       id="irtfstate">
                                <label for="{{ form.irtfstate.id_for_label }}" class="form-check-label fw-bold">IRTF State</label>
                            </div>
                        </div>
                        <div class="col-sm-8">{{ form.irtfstate|add_class:"select2-field"|attr:"data-minimum-input-length:0"|attr:"data-max-entries:1"|attr:"data-minimum-results-for-search:Infinity" }}</div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4">
                            <div class="form-check">
                                <input type="radio"
                                       class="form-check-input"
                                       name="by"
                                       value="stream"
                                       {% if form.by.value == "stream" %}checked{% endif %}
                                       id="stream">
                                <label for="{{ form.stream.id_for_label }}" class="form-check-label fw-bold">Stream</label>
                            </div>
                        </div>
                        <div class="col-sm-8">{{ form.stream|add_class:"select2-field"|attr:"data-minimum-input-length:0"|attr:"data-max-entries:1"|attr:"data-minimum-results-for-search:Infinity" }}</div>
                    </div>
                    <div class="row mb-3 search_field">
                        <div class="col-sm-4 d-grid">
                            <button class="btn btn-primary" type="submit">
                                <i class="bi bi-search"></i>
                                Search
                            </button>
                        </div>
                        <div class="offset-sm-4 col-sm-4 d-grid">
                            <button class="btn btn-secondary" type="reset">Clear</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<p class="text-center pt-5">
    <a class="btn btn-outline-primary btn-sm" href="https://www.ietf.org/search">Search page for www.ietf.org website</a>
    <a class="btn btn-outline-primary btn-sm" href="https://mailarchive.ietf.org/arch/">Search page for IETF mail list archives</a>
</p>